package sketch.metapost;

import java.util.ArrayList;
import java.util.List;

public class MPPolyLine implements MPObject {

	public List<MPPoint> points;

	public MPPolyLine() {
		points = new ArrayList<MPPoint>();
	}

	public void appendPoint(MPPoint p) {
		points.add(p);
	}

	public String getCode() {
		StringBuffer buf = new StringBuffer();
		buf.append("(");
		if (points.size() > 0)
			buf.append(points.get(0).getCode());
		for (int i = 1; i < points.size(); i++) {
			buf.append("--" + points.get(i).getCode());
		}
		buf.append(")");
		return buf.toString();
	}

}
